package com.liruo.treasureattic.service.user.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.liruo.treasureattic.common.model.dto.user.UserLoginReq;
import com.liruo.treasureattic.common.model.dto.user.UserRegisterReq;
import com.liruo.treasureattic.common.model.dto.user.UserUpdateReq;
import com.liruo.treasureattic.common.model.entity.User;
import com.liruo.treasureattic.common.model.vo.user.UserVo;

/**
* @author LYM
* @description 针对表【user】的数据库操作Service
* @createDate 2022-09-20 18:17:55
*/
public interface UserService extends IService<User> {
    /**
     * 可以提前检查username
     */
    boolean existsByUn(String username);
    /**
     * 先进行一些检查，验证码验证完后如果出现异常，必须是无关大雅的异常，比如保存avatar，只有在保存user时出错，才需要整个流程重新执行
     *  avatar没有会设为默认的
     */
    Long registerByEmail(UserRegisterReq userRegisterReq);

    UserVo loginByEmail(UserLoginReq loginReq);
    UserVo getUserVoById(long id);
    UserVo updateUserById(UserUpdateReq userUpdateReq, Long userId);


    boolean existsById(Long id);

    void follow(Long followerId, Long followId, Boolean doFollow);
}